package com.sg.business.commons.labelprovider.work;

import com.mobnut.commons.util.file.FileUtil;
import com.mobnut.db.model.PrimaryObject;
import com.sg.business.commons.labelprovider.linestyle.LineStyleHtmlLabel;
import com.sg.business.model.Work;
import com.sg.business.resource.BusinessResource;

public class AssignmentHtmlLabel extends LineStyleHtmlLabel {

	@Override
	public String getHtmlText(PrimaryObject work) {
		String assid = ((Work) work).getAssignerId();
		String userId = getContext().getAccountInfo().getConsignerId();
		StringBuffer sb = new StringBuffer();

		if (userId.equals(assid)) {
			sb.append("<img src='"); //$NON-NLS-1$
			sb.append(FileUtil.getImageURL(
					BusinessResource.IMAGE_REASSIGNMENT_16,
					BusinessResource.PLUGIN_ID, BusinessResource.IMAGE_FOLDER));
			sb.append("'style='border-style:none;position:absolute; left:0; top:4; display:block;' width='16' height='16' /> "); //$NON-NLS-1$
		}
		return sb.toString();
	}
}
